import React, { Component } from 'react';


class App extends Component {
  handleClickA = (a,e) => {
    console.log(a)
    console.log(e)
  }
  handleClickB = (c,e) => {
    console.log(c)
    console.log(e)
  }
  handleClickC = (e) => {
    console.log(e)
    console.log(e.currentTarget.dataset['index'])
  }
  render() {
    return (
      <div>
        {/* bind传参 */}
        <button onClick={this.handleClickA.bind(this,'牛')}>点击传参</button>

        {/* 箭头函数传参 */}
        <button onClick={(e)=>{this.handleClickB('羊',e)}}>箭头函数传参</button>
      
        {/* data 传参 */}
        <button data-index={'马'} onClick={this.handleClickC}>data传参</button>
      </div>
    );
  }
}

export default App;
